﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Globalization;
using System.Reflection;
using System.Web;
using System.Web.UI;
using System.Text;


using BizElements.BusinessLayer;

namespace BizElements.Web
{
    /// <summary>
    /// Generic parametrized command whose execution can be invoked on the server-side and from a Web browser.
    /// </summary>
    /// <remarks>Commands only provide execution logic. A client or another component is responsible to display them.</remarks>
    public interface IWebCommand : ICommand
    {
        /// <summary>
        /// Gets the script generated by the command which starts it's execution in the Web browser.
        /// </summary>
        string ExecuteOnClient { get; }

        /// <summary>
        /// Sets the script generated by the client which causes the form to post-back and invoke 
        /// the command's <b>Execute</b> method on the server.
        /// </summary>
        string InvokeServerSideExecution { set; }

        /// <summary>
        /// Registers all resources required to start the command execution in the Web browser.
        /// </summary>
        /// <remarks>These may include script blocks, web resources, link/include directives etc.</remarks>
        void RegisterClientSideResources();

        /// <summary>
        /// Assigns a method delegate which generates the <see cref="InvokeServerSideExecution"/> script.
        /// </summary>
        /// <param name="invokeServerSideExecutionScriptGenerator">A method which generates the <see cref="InvokeServerSideExecution"/> script. Nullable.</param>
        void SetInvokeServerSideExecutionScriptGenerator(Delegates.Procedure<IWebCommand> invokeServerSideExecutionScriptGenerator);
    }
}